package com.hxd.otc.module.my.adapter;


import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.hxd.otc.R;
import com.hxd.otc.base.BaseAdapter;
import com.hxd.otc.module.my.bean.BankCardBean;

import butterknife.BindView;
import butterknife.ButterKnife;

public class AdvertPaymentModeAdapter extends BaseAdapter<AdvertPaymentModeAdapter.PaymentModeHolder, BankCardBean> {

    public AdvertPaymentModeAdapter(Context context) {
        super(context);
    }

    @Override
    protected void onBindHolder(@NonNull PaymentModeHolder holder, int position) {
        BankCardBean item = getItem(position);
        holder.tvPayMode.setSelected(item.isSelected());
        holder.tvPayMode.setText(item.getBankName());
    }

    @NonNull
    @Override
    public PaymentModeHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new PaymentModeHolder(mInflater.inflate(R.layout.item_pay_mode, parent, false));
    }

    static class PaymentModeHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.tv_pay_mode)
        TextView tvPayMode;

        PaymentModeHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
